#include<iostream>
using namespace std;
int a[27]={0,0,1,2,3,0,1,2,0,0,2,2,4,5,5,0,1,2,6,2,3,0,1,0,2,0,2};
char s[100];
int k;
int main()
{
  while (gets(s)!=0)
  {
    for (k=0;k<strlen(s);k++)
    if (a[s[k]-'A'+1]!=0)    
    if (a[s[k]-'A'+1]!=a[s[k+1]-'A'+1]) printf("%d",a[s[k]-'A'+1]);
    printf("\n");
  } 
  return 0;   
}
